import request from '@/router/axios';

// 章节的新增
export const addDetail = (courseDetail) => {
  return request({
    url: '/api/blade-course/detail/addDetail',
    method: 'post',
    data: courseDetail
  })
}

export const addvideo = (courseDetail) => {
  return request({
    url: '/api/blade-course/detail/addvideo',
    method: 'post',
    data: courseDetail
  })
}

// 获取字典表下拉框
export const targetCrowd = (code) => {
  return request({
    url: '/api/blade-course/course/targetCrowd',
    method: 'get',
    params: {
      code
    }
  })
}

export const courseList = (current, name, size) => {
  return request({
    url: '/api/blade-course/course/courseList',
    method: 'get',
    params: {
      current,
      name,
      size
    }
  })
}


export const courseTree = (id) => {
  return request({
    url: '/api/blade-course/detail/detailTree',
    method: 'get',
    params: {
      id

    }
  })
}

export const removeDetail = (ids) => {
  return request({
    url: '/api/blade-course/detail/removeDetail',
    method: 'get',
    params: {
      ids

    }
  })
}

export const selectDetail = (ids) => {
  return request({
    url: '/api/blade-course/detail/selectDetail',
    method: 'get',
    params: {
      ids

    }
  })
}
// 课程编辑 新增
export const submit = (course) => {
  return request({
    url: '/api/blade-course/course/submit',
    method: 'post',
    headers: {
      'Content-Type': "application/json"
    },
    data: course

  })
}

// 删除课程
export const remove = (ids) => {
  return request({
    url: '/api/blade-course/course/remove',
    method: 'get',
    params: {
      ids,
    }
  })
}

export const update = (id) => {
  return request({
    url: '/api/blade-course/course/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const typeDetail = () => {
  return request({
    url: '/api/blade-course/type/detail',
    method: 'get'
  })
}

// 查看指定课程福利
export const courceListShare = (课程主键) => {
  return request({
    url: '/api/blade-course/welfareShare/courceListShare',
    method: 'get',
    params: {
      课程主键
    }
  })
}

// 新增活动-分享福利
export const submitShare = (row) => {
  return request({
    url: '/api/blade-activity/welfareShare/submitShare',
    method: 'post',
    data: row
  })
}

// 新增交易福利
export const submitBuy = (row) => {
  return request({
    url: '/api/blade-course/welfareBuy/submitBuy',
    method: 'post',
    data: row
  })
}

// 福利领取范围
export const searchBuy = (id) => {
  return request({
    url: '/api/blade-activity/welfareScope/searchBuy',
    method: 'get',
    params: {
      id
    }
  })
}

// 新增福利范围
// export const submitScope = (row) => {
//   return request({
//     url: '/api/blade-activity/welfareScope/submitScope',
//     method: 'post',
//     data: row
//   })
// }

export const submitScope = (row) => {
  return request({
    url: '/api/blade-activity/activity/addActivity',
    method: 'post',
    data: row
  })
}

// 查看单条分享福利信息
export const searchShare = (id) => {
  return request({
    url: '/api/blade-course/welfareShare/searchShare',
    method: 'get',
    params: {
      id
    }
  })
}

// 查看单条交易福利信息
export const courseSearchBuy = (id) => {
  return request({
    url: '/api/blade-course/welfareShare/courseSearchBuy',
    method: 'get',
    params: {
      id
    }
  })
}

export const addVideos = (file) => {
  return request({
    url: '/api/updateFile/uploadFileVideo',
    method: 'post',
    params: {
      file
    },
  })
}

// 新增分享福利
export const addWare = (obj) => {
  return request({
    url: '/api/blade-course/welfareShare/submitShare',
    method: 'post',
    data: obj
  })

}

// 新增交易福利
export const addTrade = (obj) => {
  return request({
    url: '/api/blade-course/welfareBuy/submitBuy',
    method: 'post',
    data: obj
  })

}

// 福利区域
export const settingArea = (obj) => {
  return request({
    url: '/api/blade-course/welfareScope/submitScope',
    method: 'post',
    data: obj
  })
}

// 删除交易福利信息
export const removeBuy = (ids) => {
  return request({
    url: '/api/blade-course/welfareShare/removeBuy',
    method: 'get',
    params: {
      ids
    }
  })
}

// 删除交易福利信息
export const removeShare = (ids) => {
  return request({
    url: '/api/blade-course/welfareShare/removeShare',
    method: 'get',
    params: {
      ids
    }
  })
}

export const gteDetail = (id) => {
  return request({
    url: '/api/blade-activity/activity/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const delTicket = (ids) => {
  return request({
    url: '/api/blade-activity/activity/removeTiket',
    method: 'get',
    params: {
      ids
    }
  })
}

